package com.nuliji.tools;

import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

/**
 * Created by GaoJie on 2017/11/1.
 */
public class Response<T> implements Serializable {

    @ApiModelProperty(value = "状态：0为正常", required = true)
    private int status = 0;

    @ApiModelProperty(value = "错误消息", notes = "错误时返回", required = false)
    private String message = "";

    @ApiModelProperty(value = "结果集", required = true)
    private T result = null;

    public Response(int status, String message, T result){
        this.status = status;
        this.message = message;
        this.result = result;
    }

    public int getStatus() {
        return status;
    }

    public String getMessage() {
        return message;
    }

    public T getResult() {
        return result;
    }

    @Override
    public String toString(){
        return JSON.toJSONString(this);
    }

}